{extend name="public\basic"}
{block name="main"}
<style>
    .roles{
        width:100%;
        background-color:#FFF;
        height:calc(100vh - 270px);
    }
    .roles a{
        color:#3a3a3a !important;
    }
    .roles a:hover{
        color:#FFF !important;
        background-color:#ababab !important;
    }
    .u-nav-itemed{
        color:#FFF !important;
        background-color:#ababab !important;
    }
    .u-table{
        border-style:solid;
        border-width:1px;
        border-color:#ababab;
    }
    .nodes{
        height:calc(100vh - 239px);
        border-width:1px 1px 1px 0;

    }
    .u-table-head{
        padding:3px 6px;
        font-size:1.2em;
        background-color:#cacaca;
    }
    .pd12{padding:12px;}
    .mgnl24{margin-left:24px;}
    .u-box{margin-top:5px;display:inline-block;}
    .opt>button{
        margin:12px;
    }

    .fr{float:right;}
</style>
<form class="layui-form ajax"  action="{:url('/home/auth/auth_edit', 'id='.$id)}" method="post">
    <div >
       {:get_tree_view($list)}
    </div>
    <div class = "opt" >
      <button class="layui-btn layui-btn-normal fr" type="submit">
          <i class="fa fa-check bigger-110"></i> 保存
      </button> &nbsp; &nbsp; &nbsp;
        <button class="layui-btn layui-btn-primary fr" type="reset" onclick="history.go(-1);">
            <i class="fa fa-undo bigger-110"></i> 返回
        </button>
    </div>
</form>
<script>
    $(function(){
        layui.use("form",function(){
            var form = layui.form;
            form.on("checkbox(group)",function(data){
                if(data.elem.checked){
                    $("input[action-type='child'][action-group='"+data.elem.value+"']").attr("checked","true");
                }else{
                    $("input[action-type='child'][action-group='"+data.elem.value+"']").removeAttr("checked");
                }
                form.render("checkbox");
            });
            form.on("checkbox(all)",function(data){
                if(data.elem.checked){
                    $("input[type='checkbox']").attr("checked","true");
                }else{
                    $("input[type='checkbox']").removeAttr("checked");
                }
                form.render("checkbox");
            });
        });
    });
</script>
{/block}
